/*
 * Copyright (C) 2012 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * This code is not supported by Google
 *
 */

package com.google.enterprise.gsa.commerce;

import java.util.Vector;


public class Facet {

		private Vector<FacetValue> values;
		private String name;
		private String display_name;
		private boolean is_range_value = false;
		
		public static String VALUE = "0";
		public static String RANGE = "1";
		
		public Facet(String name, String display_name) {
			this.name = name;
			this.display_name = display_name;
			this.values = new Vector<FacetValue>();
		}
		
		public Vector<FacetValue> getFacetValues() {
			return values;
		}
			
		public String getName() {
		    return this.name;		   
		}	
		
		public String getDisplayName() {
			return this.display_name;
		}
		
		public void addTextValue(String name, int count) {
			FacetValue f = new FacetValue(name,count);
		    values.add(f);		
		}
		
		public void addRangeValue(float min, float max, int count) {
			is_range_value = true;
			FacetValue f = new FacetValue(min,max,count);
		    values.add(f);		
		}	
		
		public boolean isRangeValue() {
			return this.is_range_value;
		}
	}
